namespace tt{

template<typename Type>
ScopedPtr<Type>::ScopedPtr(pointer_type pointer /*= NULL*/)
: m_pointer(pointer)
{

}

template<typename Type>
ScopedPtr<Type>::~ScopedPtr()
{
	if (m_pointer)
	{
		ttDelete(m_pointer);
	}
}


template<typename Type>
void ScopedPtr<Type>::reset( pointer_type pointer /*= NULL*/ )
{
	ScopedPtr tmp(pointer);
	tmp.swap(*this);
}

template<typename Type>
void ScopedPtr<Type>::swap( ScopedPtr& other )
{
	std::swap(m_pointer, other.m_pointer);
}

template<typename Type>
typename ScopedPtr<Type>::pointer_type ScopedPtr<Type>::operator->() const
{
	return m_pointer;
}

template<typename Type>
typename ScopedPtr<Type>::reference_type ScopedPtr<Type>::operator*() const
{
	return *m_pointer;
}

template<typename Type>
ScopedPtr<Type>::operator pointer_type() const
{
	return m_pointer;
}

template<typename Type>
typename ScopedPtr<Type>::pointer_type ScopedPtr<Type>::get() const
{
	return m_pointer;
}

} //namespace tt